﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Color x:Key="ButtonBackgroundColor">#00FFA500</Color>
    <Color x:Key="ButtonForegroundColor">#FFFFA500</Color>
    <Color x:Key="ButtonBackgroundMouseOverColor">#50FFA500</Color>
    <Color x:Key="DisabledButtonBackgroundColor">#00FFA500</Color>
    <Color x:Key="DisabledButtonForegroundColor">#70FFA500</Color>
    <Color x:Key="ButtonPressedBackgroundColor">#FFFFA500</Color>
    <Color x:Key="ButtonPressedForegroundColor">Black</Color>

    <DockPanel x:Key="MinimizeGraphic" Height="8">
        <Rectangle HorizontalAlignment="Center" VerticalAlignment="Center"
                           Height="3" Width="10"
                           Fill="{Binding Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Button}}}" />
    </DockPanel>

    <DockPanel x:Key="CollapseGraphic" Height="8">
        <Path HorizontalAlignment="Center" VerticalAlignment="Center"
                      Stretch="Uniform"
                      Stroke="{Binding Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button}}"
                      StrokeStartLineCap="Square" StrokeEndLineCap="Square"
                      StrokeThickness="2"
                      Data="M 0,10 L 10,0 L 20,10">
        </Path>
    </DockPanel>

    <DockPanel x:Key="ExpandGraphic" Height="8">
        <Path HorizontalAlignment="Center" VerticalAlignment="Center"
                      Stretch="Uniform"
                      Stroke="{Binding Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button}}"
                      StrokeStartLineCap="Round" StrokeEndLineCap="Round"
                      StrokeThickness="2"
                      Data="M 0,0 L 10,10 L 20,0">
        </Path>
    </DockPanel>

    <DockPanel x:Key="CloseGraphic" Height="8">
        <Path HorizontalAlignment="Center" VerticalAlignment="Center"
                      Stretch="Uniform"
                      Stroke="{Binding Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button}}"
                      StrokeStartLineCap="Round" StrokeEndLineCap="Round"
                      StrokeThickness="2">
            <Path.Data>
                <PathGeometry>
                    <PathGeometry.Figures>
                        <PathFigure StartPoint="0,0">
                            <LineSegment Point="20,20"/>
                        </PathFigure>
                        <PathFigure StartPoint="0,20">
                            <LineSegment Point="20,0"/>
                        </PathFigure>
                    </PathGeometry.Figures>
                </PathGeometry>
            </Path.Data>
        </Path>
    </DockPanel>

    <Style x:Key="ButtonFocusStyle">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border>
                        <Rectangle Margin="2" StrokeThickness="1" Stroke="#60000000" StrokeDashArray="1 2" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="TitleBarButtonStyle"
                   TargetType="Button">
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusStyle}" />
        <Setter Property="MinHeight" Value="10" />
        <Setter Property="MinWidth" Value="10" />
        <Setter Property="Foreground" Value="Orange" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border x:Name="Border"
                                    TextBlock.Foreground="{TemplateBinding Foreground}"
                                    CornerRadius="0">
                        <Border.Background>
                            <SolidColorBrush  Color="{DynamicResource ButtonBackgroundColor}" />
                        </Border.Background>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.15" />
                                    <VisualTransition GeneratedDuration="0" To="Pressed" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"
                                                                              Storyboard.TargetName="Border">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource ButtonBackgroundMouseOverColor}" />
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"
                                                    Storyboard.TargetName="Border">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource ButtonPressedBackgroundColor}" />
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"
                                                    Storyboard.TargetName="Border">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource DisabledButtonBackgroundColor}" />
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)"
                                                    Storyboard.TargetName="Border">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource DisabledButtonForegroundColor}" />
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ContentPresenter Margin="5"
                                                  HorizontalAlignment="Center"
                                                  VerticalAlignment="Center"
                                                  RecognizesAccessKey="True" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsPressed" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard TargetProperty="(Button.Foreground).(SolidColorBrush.Color)">
                                        <ColorAnimation To="{StaticResource ButtonPressedForegroundColor}" BeginTime="0" Duration="0" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard TargetProperty="(Button.Foreground).(SolidColorBrush.Color)">
                                        <ColorAnimation To="{StaticResource ButtonForegroundColor}" BeginTime="0" Duration="0" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard TargetProperty="(Button.Foreground).(SolidColorBrush.Color)">
                                        <ColorAnimation To="{StaticResource DisabledButtonForegroundColor}" BeginTime="0" Duration="0" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard TargetProperty="(Button.Foreground).(SolidColorBrush.Color)">
                                        <ColorAnimation To="{StaticResource ButtonForegroundColor}" BeginTime="0" Duration="0" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <LinearGradientBrush x:Key="TitleBarBorderBrush" Opacity="1">
        <GradientStop Color="#FFFFA500" Offset="0"/>
        <GradientStop Color="#00FFA500" Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="TitleBarBackgroundBrush" Opacity="1">
        <GradientStop Color="#015B4411" Offset="0.5"/>
        <GradientStop Color="#005B4411" Offset="1"/>
    </LinearGradientBrush>

    <Style x:Key="TitleBarStyle" TargetType="Border">
        <Setter Property="BorderBrush" Value="{StaticResource TitleBarBorderBrush}" />
        <Setter Property="Background" Value="{StaticResource TitleBarBackgroundBrush}" />
        <Setter Property="BorderThickness" Value="0,1,0,1" />
    </Style>

</ResourceDictionary>